package cn.zjutleo.village_server.mapper;

import cn.zjutleo.village_server.entity.AddressData;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: 张坤
 * @DateTime: 2021/9/30 12:28
 * @Description: 该类用于 TODO
 */
public interface AddressDataMapper {
    @Results(id = "AddressDataBaseResults",value = {
            @Result(column = "code",property = "code"),
            @Result(column = "name", property = "name")
    })
    @Select("select * from provinces")
    List<AddressData> getAllProvinces();

    @ResultMap("AddressDataBaseResults")
    @Select("select * from cities where provinceCode=${code}")
    List<AddressData> getCtites(String code);

    @ResultMap("AddressDataBaseResults")
    @Select("select * from areas where cityCode=${code}")
    List<AddressData> getAreas(String code);

    @ResultMap("AddressDataBaseResults")
    @Select("select * from streets where areaCode=${code}")
    List<AddressData> getStreets(String code);

    @ResultMap("AddressDataBaseResults")
    @Select("select * from villages where streetCode=${code}")
    List<AddressData> getVillages(String code);


}
